<?php
// application/forms/Media.php

/**
 * This is the guestbook form.  It is in its own directory in the application 
 * structure because it represents a "composite asset" in your application.  By 
 * "composite", it is meant that the form encompasses several aspects of the 
 * application: it handles part of the display logic (view), it also handles 
 * validation and filtering (controller and model).  
 */
class article_Form_Media extends Zend_Form
{

    protected $_noDecorator = array(
        'ViewHelper', 
        'Errors'
    );
    public function init()
    {
        // set the method for the display form to POST
        $this->setAttrib('id', 'new_article');
        $this->setMethod('POST');
        $this->setAction('/'.$_SESSION['myLang'].'/article/index/new');
        

        $filterTrim = new Zend_Filter_StringTrim();
        $myValidator = new Zend_Validate_Alnum();
        $isValidator = new Zend_Validate_Digits();
        $this->addElementPrefixPath('Clu_Filter', 'Clu/Filter/', 'filter');
                
       
        //add media type
        $media_type = new Zend_Form_Element_Select('media_type', 
                         array('disableLoadDefaultDecorators' => true,
                               'required'   => true,             
                               'class' => 'inputText'));

        $media_type->addMultiOption('embeded_video',__('Video'))
               ->addMultiOption('image',__('Imagie'))
               ->addMultiOption('flash',__('Flash'))
               ->addMultiOption('pdf',__('PDF file'))
               ->addMultiOption('doc',__('Document file'))
               ->addDecorators($this->_noDecorator);
        $this->addElement($media_type);
        
        //add media path
        $media_path = new Zend_Form_Element_Text('media_path', 
                         array('disableLoadDefaultDecorators' => true,
                               'required'   => true,             
                               'class' => 'inputText'));
        
        $media_path->addDecorators($this->_noDecorator);
     //         ->addValidator($dateValidator);
        $this->addElement($media_path);
        
        //add video src
        $video_src = new Zend_Form_Element_Text('video_src', 
                         array('disableLoadDefaultDecorators' => true,
                               'required'   => true,             
                               'class' => 'inputText'));
        
        $video_src->addDecorators($this->_noDecorator)
              ->addValidator($isValidator);
        $this->addElement($video_src);
        
        //add videoid
        $video_id = new Zend_Form_Element_Text('video_id', 
                         array('disableLoadDefaultDecorators' => true,
                               'required'   => true,             
                               'class' => 'inputText'));
        
        $video_id->addDecorators($this->_noDecorator)
              ->addFilter($filterTrim)
              ->addValidator($myValidator);
        $this->addElement($video_id);
                      
        // add the submit button

        $submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true, 
                                                               'label' => __('Submit') ));
        $submit->addDecorators($this->_noDecorator);
        $this->addElement($submit);
    }
}
